<?php
/**
* @author Bimal Poudel
* @copyright since 2006, Bimal Poudel
* @package Smarty Framework
* @support http://www.odesk.com/users/~~dd91d11caed0cdce
* @contact http://www.sanjaal.com
* @company Sanjaal Corps
*/

# Created on: 2012-04-08 12:50:53 506

/**
* Lists entities in users
*/

# When a user will cancel add/edit forms, we will try to come back here
url::remember();

# Begin the paginator along with: users
# Parameter: GET[], and per page
$pagination = new pagination('pg', __PER_PAGE__);

$users = new users();

# Be sure NOT to load too many entiries. Save the database
# Please modify this code, particularly for:
#	Page Limits
#	Selection Conditions
$search_users = $variable->remember_string('search_users');
$smarty->assign('search_users', $search_users);

$condition = new condition();

$condition->add('FULL', array(
	"e.subdomain_id={$subdomain_id}", # Bind the records with this subdomain only
	"e.is_active='Y'", # Do not remove this
	#"e.is_approved='Y'", # Optionally use this flag
	
	# In search.php
	# $search_users?"(e.field_name LIKE '%{$search_users}%' OR e.field_name LIKE '%{$search_users}%')":'',
));

# Compulsory conditions
$condition->add('AND', array(
	#'e.search_field' => 'Y', # Partial %contents%
));

# List out the entries
$entries = $users->list_entries(
	$condition,
	$from_index=$pagination->begining_entry(),
	$pagination->per_page()
);

# Pagination helper
$pagination->set_total($users->total_entries());
$smarty->assignByRef('pagination', $pagination);

# Assign to Smarty: Lists
$smarty->assignByRef('userss', $entries);
?>